home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / misc / volume11 / starchart / part05 < prev    next >
Encoding:
Text File  |  1990-03-15  |  48.2 KB  |  1,753 lines

  1. Newsgroups: comp.sources.misc
  2. subject: v11i033: starchart 3.2 Part 05/32
  3. from: ccount@ATHENA.MIT.EDU
  4. Sender: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc)
  5.  
  6. Posting-number: Volume 11, Issue 33
  7. Submitted-by: ccount@ATHENA.MIT.EDU
  8. Archive-name: starchart/part05
  9.  
  10. #! /bin/sh
  11. # This is a shell archive.  Remove anything before this line, then unpack
  12. # it by saving it into a file and typing "sh file".  To overwrite existing
  13. # files, type "sh file -c".  You can also feed this as standard input via
  14. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  15. # will see the following message at the end:
  16. #        "End of archive 5 (of 32)."
  17. # Contents:  doc/observe.1 observe/datelib.c observe/observe.h
  18. #   observe/satcalc.c starchart/interact.c starchart/starcust.c
  19. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  20. if test -f 'doc/observe.1' -a "${1}" != "-c" ; then 
  21.   echo shar: Will not clobber existing file \"'doc/observe.1'\"
  22. else
  23. echo shar: Extracting \"'doc/observe.1'\" \(7858 characters\)
  24. sed "s/^X//" >'doc/observe.1' <<'END_OF_FILE'
  25. X.TH OBSERVE LOCAL "15 July 1989"
  26. X.ad b
  27. X.SH NAME
  28. Xobserve \- observing session planning aid, ephemeris generation, and more.
  29. X.SH SYNOPSIS
  30. X.B observe
  31. X[
  32. X.BI \-m " longitude_hrs"
  33. X[
  34. X.I long_min
  35. X[
  36. X.I long_sec
  37. X]
  38. X]
  39. X]
  40. X.br
  41. X.if t .ti +.5i
  42. X[
  43. X.BI \-l " latitude_hrs"
  44. X[
  45. X.I lat_min
  46. X[
  47. X.I lat_sec
  48. X]
  49. X]
  50. X]
  51. X.br
  52. X.if t .ti +.5i
  53. X[
  54. X.BI \-a " altitude_meters"
  55. X]
  56. X[
  57. X.BI \-z " time_zone_hrs"
  58. X]
  59. X.br
  60. X.if t .ti +.5i
  61. X[
  62. X.B \-d
  63. X\fI"start_date"\fR
  64. X[
  65. X\fI"end_date"\fR
  66. X[
  67. X.I interval_days
  68. X]
  69. X]
  70. X]
  71. X.br
  72. X.if t .ti +.5i
  73. X[
  74. X.BI \-o[[\fIa\fR][\fIe\fR][\fIi\fR][\fIo\fR][\fIs\fR]] " outfilename_root"
  75. X]
  76. X.br
  77. X.if t .ti +.5i
  78. X[
  79. X.B \-p
  80. X[
  81. X[\fIM\fR][\fIV\fR][\fIm\fR][\fIJ\fR][\fIs\fR][\fIU\fR][\fIN\fR]
  82. X]
  83. X]
  84. X[
  85. X.BI \-s i
  86. X]
  87. X.br
  88. X.if t .ti +.5i
  89. X[
  90. X.BI \-f " filename format"
  91. X]
  92. X[
  93. X.BI \-n " object_name"
  94. X]
  95. X
  96. X
  97. X.SH DESCRIPTION
  98. XThe program is used to prepare for astronomical observations and for
  99. Xephemeris calculation.  It can calculate the position of the major
  100. Xplanets, the satellites of Jupiter and Saturn, and minor planets and
  101. Xcomets given either orbital elements or a tabulated ephemeris.
  102. XCoordinates of stationary objects may also be input.  It calculates
  103. X(approximate) rise and set times, and transit times, of all objects to
  104. Xbe observed.
  105. X.PP
  106. XThe information (coordinates, rise and set times) may be prepared for either
  107. Xa single time or a sequence of times.
  108. X.PP
  109. XOutput includes a file containing the timetable of events for the evening or
  110. Xevenings.  The coordinates of the sun and moon, plus any planets, minor
  111. Xplanets, and comets are placed in a readable text file, with other calculated
  112. Xvalues for solar system objects (e.g. distance to earth).  The coordinates
  113. Xof all objects to be observed are placed in files in formats to be read by
  114. Xthe other programs in this family, namely "dataconv" and the starchart
  115. Xcharting programs.  If satellite positions are to be computed, these
  116. Xcoordinates are placed in one file, and a separate PostScript file
  117. Xgraphically showing their positions relative to the primary is also
  118. Xproduced.
  119. X.PP
  120. XParameters set the location of the observer, control
  121. Xwhat objects are to be observed, and designate the time or times of
  122. Xinterest.
  123. X.PP
  124. XThe file \fIfilename\fR may be in one of several ephemeris
  125. Xformats for a single object:
  126. X.br
  127. X.nf
  128. X.ta \w'empb    'u
  129. Xemp    - Format used in the Russian \fIEphemerides of minor planets\fR.
  130. X.br
  131. Xempb    - Format used in the Russian \fIEphemerides of minor planets\fR for
  132. X        bright and unusual asteroids.
  133. X.br
  134. Xaa    - Format used by Astronomical Almanac.
  135. X.br
  136. Xst    - Format commonly used by Sky and Telescope.
  137. X.br
  138. Xiau    - Format commonly used by IAU Circulars.
  139. X.fi
  140. X.PP
  141. XOr it may be contain orbital elements for one or more objects:
  142. X.br
  143. X.nf
  144. X.ta \w'par_e    'u
  145. Xell_e    - elliptical orbital elements.
  146. X.br
  147. Xpar_e    - parabolic orbital elements.
  148. X.fi
  149. X.PP
  150. XOr it may contain coordinates of fixed objects:
  151. X.br
  152. X.nf
  153. X.ta \w'par_e    'u
  154. Xobj    -  fixed object coordinates.
  155. X.br
  156. X.fi
  157. X.PP
  158. XIf the file \fIfilename\fR is in one of the ephemeris formats, it
  159. Xcontains ephemeris data for object named "obj_name".
  160. X.PP
  161. XInterpolation of the data is performed from the date
  162. Xspecified by the string \fIstart_date\fR until the \fIend_date\fR,
  163. Xwith interval between interpolated points of \fIinterval\fR days.  The
  164. X"lineread" and "sif" files contain commands to draw a solid vector
  165. Xbetween calculated points, and draw the object symbol and label with
  166. Xname.
  167. X.PP
  168. X
  169. XAll ephemeris formats have date RA DEC, then other info.  Date is month in
  170. Xcharacters, then date  How the month is encoded is format dependent,
  171. Xexamples include "IX" "Sept." "Sep" "Sep." "September".  Year is
  172. Xcurrent year unless specified in command line, and is the year of the
  173. Xfirst date.  Dates must be in increasing order: 3 followed by 4,
  174. XDecember followed by January.
  175. X.PP
  176. XThe orbital element formats may be used to conveniently calculate
  177. Xcoordinates of asteroids and comets.
  178. X.PP
  179. XOutput files are named \fIoutfile_root.X\fR where X is:
  180. X.nf
  181. X.ta \w'.sat_PS    'u
  182. Xaltaz    - altitude and azimuth of objects at sunrise and sunset, and
  183. X        morning and evening twilights.
  184. X.br
  185. Xeph    - ephemeris of sun, moon and objects specified.
  186. X.br
  187. Xobs    - observability of objects: rise and set times of objects,
  188. X        twilight times, etc.
  189. X.br
  190. Xstar    - "lineread" format file containing coordinates (equinox
  191. X       2000) of the object(s), sun, moon.
  192. X.br
  193. Xsif    - "sif" format file containing the same information as the
  194. X       .star file.  The separation character is ";".
  195. X.br
  196. Xsat    - Locations of the major satellites of Jupiter and Saturn with
  197. X       respect to the primary.
  198. X.br
  199. Xsat_PS    - PostScript file drawing either: one page showing appearance of
  200. X        Jupiter and Saturn with satellites, and relative sizes and
  201. X        orientations of Mercury, Venus, Mars, Jupiter, and Saturn,
  202. X        and the Moon; or several pages showing Jupiter and Saturn
  203. X        with moons on a sequence of times if a range of dates was
  204. X        specified.
  205. X.PP
  206. XThe default \fIoutfile_root\fR is set at compile time.  The usual
  207. Xdefault is "planet" for historical reasons.  A character or characters
  208. Ximmediately following the \fB-o\fR option may select a subset of these
  209. Xfiles to be output.  The characters "aeios" specify the altaz, eph,
  210. Xsif, obs, and star files respectively.
  211. X.PP
  212. XThe options controlling the location of the observer are
  213. X.TP
  214. X.B \-m
  215. XMeridian of longitude, measured East of Greenwich.  The USA is West of
  216. XGreenwich, and the longitude is negative for all USA locations.
  217. X.TP
  218. X.B \-l
  219. XLatitude.
  220. X.TP
  221. X.B \-a
  222. XAltitude in meters.
  223. X.TP
  224. X.B \-z
  225. XTime zone in hours East of Greenwich, again, this number is negative
  226. Xfor USA locations.  This does not include any effects of daylight
  227. Xsavings.
  228. X.fi
  229. X.PP
  230. XThe defaults for these parameters are set when the program is compiled.
  231. X.PP
  232. XThe date or dates of observation in UT are specified with the \fB-d\fR
  233. Xflag.  The dates for the \fB-d\fR option are each specified as a string
  234. Xconsisting of month, day, and optional year (use if different from the
  235. Xcurrent year).  The month may be encoded as above, e.g. "Aug" for
  236. Xaugust.  Using the first three letters of the English name for the
  237. Xmonth always works,  as does the Roman numeral form.  Some other
  238. Xcommon abbreviations also work.  The year may also be specified, the
  239. Xdefault is the current year.  The day may be fractional, e.g. 1.25 is
  240. X6 am UT on the first.  An optional third parameter is the increment of
  241. Xtime to be used in stepping between the two dates.
  242. X.PP
  243. XThe positions of any or all of the major planets at the time(s) may be
  244. Xcalculated.  This is specified either as \fB-p\fR which causes the
  245. Xpositions of all planets to be calculated, or individual planets may
  246. Xbe specified by following the \fB-p\fR with a letter or letters from
  247. Xthe sequence "MVmJsUN".  The positions of the sun and moon are always
  248. Xcalculated, since they always have some effect on observing
  249. Xconditions.
  250. X.PP
  251. XThe \fB-s\fR option causes the ".sat"and ".sat_PS" files to be
  252. Xproduced for the satellites of Jupiter and Saturn.  \fB-s\fR implies
  253. X\fB-p\fR.  With the \fB-si\fR option the drawings in the PS file are
  254. Xflipped north to south (if for one time) or east to west (if for
  255. Xmultiple times) to produce an inverted view.
  256. X.SH EXAMPLES
  257. Xobserve -f cer.empb empb -d "Nov 3" "Nov 5"
  258. X.br
  259. Xobserve -si -d "aug 1 1980" "Aug 31"
  260. X.br
  261. Xobserve -f asteroids.ell_e ell_e -d "Sep 1" "sep 5" 0.25 -oe test
  262. X.br
  263. Xobserve -m -72 33 25 -l 54 40 -a 1050
  264. X.SH FILES
  265. XSee sample data files for formats.
  266. X.SH BUGS
  267. XMinor corrections such as parallax and nutation are not made.
  268. X.PP
  269. XPositions are accurate enough for most applications other than
  270. Xoccultations.
  271. X.PP
  272. XRise and set times may be off by several minutes.
  273. X.PP
  274. XPositions opf Saturn's satellites are approximate, good enough for
  275. Xidentification of satellites.
  276. X.SH AUTHOR
  277. XCraig Counterman
  278. X.br
  279. X.sp
  280. Xparts from \fIplanet\fR by
  281. X.br
  282. XF.T. Mendenhall <ihnp4!inuxe!fred>
  283. X.br
  284. XJim Cobb <jcobb@gr.utah.edu>
  285. X.br
  286. XAlan Paeth <AWPaeth@watCGL>
  287. X.SH SOURCES
  288. X\fIAstronomical Formulae for Calculators\fR by Jean Meesus
  289. X.br
  290. X\fIAstronomical Almanac 1989\fR
  291. END_OF_FILE
  292. if test 7858 -ne `wc -c <'doc/observe.1'`; then
  293.     echo shar: \"'doc/observe.1'\" unpacked with wrong size!
  294. fi
  295. # end of 'doc/observe.1'
  296. fi
  297. if test -f 'observe/datelib.c' -a "${1}" != "-c" ; then 
  298.   echo shar: Will not clobber existing file \"'observe/datelib.c'\"
  299. else
  300. echo shar: Extracting \"'observe/datelib.c'\" \(6401 characters\)
  301. sed "s/^X//" >'observe/datelib.c' <<'END_OF_FILE'
  302. X/*
  303. X * datelib.c
  304. X * date routines
  305. X *
  306. X * Copyright (c) 1990 by Craig Counterman. All rights reserved.
  307. X *
  308. X * This software may be redistributed freely, not sold.
  309. X * This copyright notice and disclaimer of warranty must remain
  310. X *    unchanged. 
  311. X *
  312. X * No representation is made about the suitability of this
  313. X * software for any purpose.  It is provided "as is" without express or
  314. X * implied warranty, to the extent permitted by applicable law.
  315. X *
  316. X */
  317. X
  318. X
  319. X#ifndef  lint
  320. Xstatic char rcsid[] =
  321. X  "$Header: datelib.c,v 1.8 90/02/23 00:16:33 ccount Exp $";
  322. X#endif
  323. X
  324. X
  325. X#include <stdio.h>
  326. X#include <math.h>
  327. X#include <ctype.h>
  328. X
  329. X#ifndef SYSV
  330. X#include <strings.h>
  331. X#else
  332. X#include <string.h>
  333. X#endif /* SYSV */
  334. X
  335. X#include "date.h"
  336. X
  337. X/* Calendar = month, day, year, where day is type double
  338. X   jd = julian date, type double
  339. X   str = string format.  Year is optional, default must be specified.
  340. X
  341. Xfunctions:
  342. Xcal_to_jd(day, month, year, &jd);
  343. Xcal_to_str(day, month, year, string);  String must be char string[15];
  344. Xjd_to_cal(jd, &day, &month, &year);
  345. Xjd_to_str(jd, string);  String must be char string[15];
  346. Xstr_to_jd(string, default_year, &jd);
  347. X                              default_year is default year,
  348. X                              used if not specified in string
  349. Xstr_to_cal(string, &day, &month, &year);
  350. X*/
  351. X
  352. Xvoid cal_to_jd(day, month, year, jd_p)
  353. X     int month, year;
  354. X     double day;
  355. X     double *jd_p;
  356. X{
  357. X  int b, d, m, y;
  358. X  long c;
  359. X
  360. X  m = month;
  361. X  y = (year < 0) ? year + 1 : year;
  362. X  if (month < 3) {
  363. X    m += 12;
  364. X    y -= 1;
  365. X  }
  366. X
  367. X  if ((year < 1582) ||
  368. X      (year == 1582 && ((month < 10)
  369. X            || ((month == 10) && (day < 15)))))
  370. X    b = 0;
  371. X  else {
  372. X    int a;
  373. X    a = y/100;
  374. X    b = 2 - a + a/4;
  375. X  }
  376. X
  377. X  if (y < 0)
  378. X    c = (long)((365.25*y) - 0.75) + 1720995L;
  379. X  else
  380. X    c = (long)(365.25*y) + 1720995L;
  381. X
  382. X  d = 30.6001*(m+1);
  383. X
  384. X  *jd_p = (b + c + d + day - 0.5);
  385. X}
  386. X
  387. Xstatic char *mname[] = {
  388. X  "",  "Jan", "Feb", "Mar", "Apr", "May", "Jun",
  389. X  "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
  390. X
  391. X
  392. Xvoid cal_to_str(day, month, year, str)
  393. X     int month, year;
  394. X     double day;
  395. X     char str[];
  396. X{
  397. X  sprintf(str, "%.2f %s %d", day, mname[month], year);
  398. X}
  399. X
  400. X
  401. Xvoid jd_to_cal(jd, day, month, year)
  402. X     double jd;
  403. X     double *day;
  404. X     int *month, *year;
  405. X{
  406. X  double d, f;
  407. X  double i, a, b, ce, g;
  408. X
  409. X  d = jd + 0.5 - 2415020L;
  410. X  i = floor(d);
  411. X  f = d-i;
  412. X  if (f == 1) {
  413. X    f = 0;
  414. X    i += 1;
  415. X  }
  416. X
  417. X  if (jd > 2299160L) {        /* After the date change in 1582 */
  418. X    a = floor((i/36524.25)+.9983573)+14;
  419. X    i += 1 + a - floor(a/4.0);
  420. X  }
  421. X
  422. X  b = floor((i/365.25)+.802601);
  423. X  ce = i - floor((365.25*b)+.750001)+416;
  424. X  g = floor(ce/30.6001);
  425. X  *month = g - 1;
  426. X  *day = ce - floor(30.6001*g)+f;
  427. X  *year = b + 1899;
  428. X
  429. X  if (g > 13.5)
  430. X    *month = g - 13;
  431. X  if (*month < 2.5)
  432. X    *year = b + 1900;
  433. X  if (*year < 1)
  434. X    *year -= 1;
  435. X}
  436. X
  437. X
  438. Xvoid jd_to_str(jd, str)
  439. X     double jd;
  440. X     char str[];
  441. X{
  442. X  int year, month;
  443. X  double day;
  444. X
  445. X  jd_to_cal(jd, &day, &month, &year);
  446. X
  447. X  sprintf(str, "%.2f %s %d", day, mname[month], year);
  448. X}
  449. X
  450. X
  451. X
  452. X
  453. X
  454. X/* Given date string and the year to be zero, give the day number:
  455. XE.g.
  456. X"100.3"             1988 => 100.3
  457. X"1/1/1988"          1988 => 1.0
  458. X"2/1/1989"          1988 => 398.0
  459. X"October 3"         1988 => 
  460. X*/
  461. Xvoid str_to_jd(s, year, jd_p)
  462. X     char *s;
  463. X     int year;
  464. X     double *jd_p;
  465. X{
  466. X  int mo, yr;
  467. X  double dy;
  468. X  double daynum;
  469. X
  470. X  /* see if it's just a number already */
  471. X  if ((index(s, ' ')) == NULL) {
  472. X    *jd_p = atof(s);
  473. X    return;
  474. X  };
  475. X
  476. X  str_to_cal(s, &dy, &mo, &yr);
  477. X  if (yr == 0) yr = year;
  478. X
  479. X  daynum = dy;
  480. X  cal_to_jd(daynum, mo, yr, jd_p);
  481. X}
  482. X
  483. X/* interpret string as month, day and perhaps year.
  484. Xyear 0 if no year in string, there is no year 0 in the calender.
  485. XE.g.:
  486. XOct. 1                  => 1 10 0
  487. XIX 23                   => 23 9 0
  488. X2/12/1987               => 12 2 1987
  489. X5-2-88                  => 2 5 1988
  490. XJanuary 23 1988         => 23 1 1988
  491. X*/
  492. X
  493. Xvoid str_to_cal(s, dy, mo, yr)
  494. X     char *s;
  495. X     double *dy;
  496. X     int *mo, *yr;
  497. X{
  498. X  int i, n;
  499. X  char string1[100], string2[100];
  500. X
  501. X  /* Is there a dash? */
  502. X  if ((index(s, '-')) != NULL) { /* YES */
  503. X    n = sscanf(s, "%lf-%d-%d", dy, mo, yr);
  504. X    if (n != 3) *yr = 0;
  505. X    return;
  506. X  }
  507. X
  508. X  /* Is there a slash? */
  509. X  if ((index(s, '/')) != NULL) { /* YES */
  510. X    n = sscanf(s, "%lf/%d/%d", dy, mo, yr);
  511. X    if (n != 3) *yr = 0;
  512. X    return;
  513. X  }
  514. X
  515. X  /* Try Month day year or Month day, year
  516. X     or day Month year */
  517. X  /* first eliminate commas */
  518. X  i = 0;
  519. X  while (s[i]) {
  520. X    if (s[i] == ',') s[i] = ' ';
  521. X    i++;
  522. X  }
  523. X
  524. X  n = sscanf(s, "%s %s %d", string1, string2, yr);
  525. X  if (n < 2) {
  526. X    fprintf(stderr, "Can't understand date %s\n", s);
  527. X    exit(1);
  528. X  } else if (n == 2) *yr = 0;
  529. X
  530. X  *mo = tr_mname(string1);
  531. X  if (*mo < 1) {
  532. X    *mo = tr_mname(string2);
  533. X    *dy = atof(string1);
  534. X  } else
  535. X    *dy = atof(string2);
  536. X
  537. X  if (*mo < 1) {
  538. X    fprintf(stderr, "Can't understand date %s\n", s);
  539. X    exit(1);
  540. X  }
  541. X}
  542. X
  543. X/* translate date string to month number */
  544. Xint tr_mname(s)
  545. X     char *s;
  546. X{
  547. X  int i = -1;
  548. X  while (s[++i]) if (isupper(s[i])) s[i] = tolower(s[i]);
  549. X
  550. X  if (!strcmp(s,"jan")
  551. X      || !strcmp(s,"jan.")
  552. X      || !strcmp(s,"i")
  553. X      || !strcmp(s,"january"))
  554. X    return 1;
  555. X
  556. X  if (!strcmp(s,"feb")
  557. X      || !strcmp(s,"feb.")
  558. X      || !strcmp(s,"ii")
  559. X      || !strcmp(s,"febuary"))
  560. X    return 2;
  561. X
  562. X  if (!strcmp(s,"mar")
  563. X      || !strcmp(s,"mar.")
  564. X      || !strcmp(s,"iii")
  565. X      || !strcmp(s,"march"))
  566. X    return 3;
  567. X
  568. X  if (!strcmp(s,"apr")
  569. X      || !strcmp(s,"apr.")
  570. X      || !strcmp(s,"iv")
  571. X      || !strcmp(s,"april"))
  572. X    return 4;
  573. X
  574. X  if (!strcmp(s,"may")
  575. X      || !strcmp(s,"v"))
  576. X    return 5;
  577. X
  578. X  if (!strcmp(s,"jun")
  579. X      || !strcmp(s,"jun.")
  580. X      || !strcmp(s,"vi")
  581. X      || !strcmp(s,"june"))
  582. X    return 6;
  583. X
  584. X  if (!strcmp(s,"jul")
  585. X      || !strcmp(s,"jul.")
  586. X      || !strcmp(s,"vii")
  587. X      || !strcmp(s,"july"))
  588. X    return 7;
  589. X
  590. X  if (!strcmp(s,"aug")
  591. X      || !strcmp(s,"aug.")
  592. X      || !strcmp(s,"viii")
  593. X      || !strcmp(s,"august"))
  594. X    return 8;
  595. X
  596. X  if (!strcmp(s,"sep")
  597. X      || !strcmp(s,"sep.")
  598. X      || !strcmp(s,"ix")
  599. X      || !strcmp(s,"september"))
  600. X    return 9;
  601. X
  602. X  if (!strcmp(s,"oct")
  603. X      || !strcmp(s,"oct.")
  604. X      || !strcmp(s,"x")
  605. X      || !strcmp(s,"october"))
  606. X    return 10;
  607. X
  608. X  if (!strcmp(s,"nov")
  609. X      || !strcmp(s,"nov.")
  610. X      || !strcmp(s,"xi")
  611. X      || !strcmp(s,"november"))
  612. X    return 11;
  613. X
  614. X  if (!strcmp(s,"dec")
  615. X      || !strcmp(s,"dec.")
  616. X      || !strcmp(s,"xii")
  617. X      || !strcmp(s,"december"))
  618. X    return 12;
  619. X
  620. X  return atoi(s);
  621. X}
  622. X
  623. END_OF_FILE
  624. if test 6401 -ne `wc -c <'observe/datelib.c'`; then
  625.     echo shar: \"'observe/datelib.c'\" unpacked with wrong size!
  626. fi
  627. # end of 'observe/datelib.c'
  628. fi
  629. if test -f 'observe/observe.h' -a "${1}" != "-c" ; then 
  630.   echo shar: Will not clobber existing file \"'observe/observe.h'\"
  631. else
  632. echo shar: Extracting \"'observe/observe.h'\" \(6607 characters\)
  633. sed "s/^X//" >'observe/observe.h' <<'END_OF_FILE'
  634. X/*
  635. X * observe.h
  636. X * Types etc. needed for observe program
  637. X *
  638. X * Copyright (c) 1990 by Craig Counterman. All rights reserved.
  639. X *
  640. X * This software may be redistributed freely, not sold.
  641. X * This copyright notice and disclaimer of warranty must remain
  642. X *    unchanged. 
  643. X *
  644. X * No representation is made about the suitability of this
  645. X * software for any purpose.  It is provided "as is" without express or
  646. X * implied warranty, to the extent permitted by applicable law.
  647. X *
  648. X */
  649. X/*
  650. X * $Header: observe.h,v 1.7 90/02/19 17:22:04 ccount Exp $
  651. X */
  652. X
  653. X
  654. Xtypedef enum {
  655. X  rise, rise_20, rise_30, transit, set_30, set_20, set, special, nothing
  656. X} event_t;
  657. X#define MAXEVENTS 7
  658. X/* order is RISE = 0 to SET = 6 with TRANSIT = 3 */
  659. X
  660. Xtypedef enum {
  661. X  rise_special, set_special, morning_twilight, evening_twilight, not_special
  662. X} special_event_t;
  663. X
  664. Xtypedef struct {
  665. X  double hour;            /* of event */
  666. X  char *object;            /* event is happening to */
  667. X  event_t event;
  668. X  special_event_t special;
  669. X                /* sun or moon rise or set,
  670. X                   twilight */
  671. X} observe_t;
  672. X
  673. Xtypedef enum {
  674. X  planet_orbit,            /* Planet */
  675. X  elliptical_orbit,        /* Elliptical Orbit */
  676. X  parabolic_orbit,        /* Parabolic Orbit */
  677. X  tabulated,            /* Tabulated */
  678. X  no_orbit
  679. X} orbtype_t;
  680. X
  681. Xtypedef enum {
  682. X  asteroid,
  683. X  comet,
  684. X  no_type
  685. X} bodytype_t;
  686. X
  687. Xtypedef struct {
  688. X  double epoch_jd;
  689. X  double equinox_year;
  690. X  double a;            /* semimajor axis, A.U. */
  691. X  double e;            /* eccentricity */
  692. X  double i;            /* inclination (degrees) */
  693. X  double omega;            /* argument of perihelion */
  694. X  double Omega;            /* longitude of ascending node */
  695. X  double n;            /* mean motion (degrees/day) */
  696. X  double M;            /* Mean anomaly at epoch */
  697. X} elliptical_elements_t;
  698. X
  699. Xtypedef struct {
  700. X  double perihelion_date;    /* Time of passage in perihelion */
  701. X  double equinox_year;
  702. X  double q;            /* perihelion distance, A.U. */
  703. X  double i;            /* inclination (degrees) */
  704. X  double omega;            /* argument of perihelion */
  705. X  double Omega;            /* longitude of ascending node */
  706. X} parabolic_elements_t;
  707. X
  708. X
  709. Xtypedef struct {
  710. X  double beta_e;        /* planetocentric declination of Earth */
  711. X  double p_n;            /* Position angle of the axis,
  712. X                   measured east from north */
  713. X  double lambda_e;        /* planetographic longitude of the central
  714. X                   meridian, measured in the direction
  715. X                   opposite to the dir. of rotation */
  716. X} rotation_elements_t;
  717. X
  718. Xtypedef struct {
  719. X  char *name;
  720. X  char *type;
  721. X  char *color;
  722. X  double alpha, delta;        /* position in equinox of date */
  723. X  double alpha2000, delta2000;    /* position in equinox 2000.0 */
  724. X  double l, b;            /* ecliptical longitude and latitude */
  725. X  double lambda, beta;        /* geocentric longitude and latitude */
  726. X  double Cen;            /* Center */
  727. X  double psi;            /* elongation */
  728. X  double r, Delta;        /* Distance to sun, and earth */
  729. X  double mag, phase, size;    /* magnitude, phase (degrees) size (arcsec) */
  730. X  double illum_frac;        /* illuminated fraction of disk */
  731. X  double chi;            /* position angle of bright limb */
  732. X  rotation_elements_t rotation_elements;
  733. X                /* beta_e, p_n, lambda_e */
  734. X  observe_t eventlist[MAXEVENTS]; /* events: rise, set, etc. */
  735. X  double rise_hour, set_hour, transit_hour;
  736. X                /* times of these events */
  737. X} planet_data_t;
  738. X
  739. Xtypedef struct {
  740. X  char *name;
  741. X  double alpha, delta;        /* position in equinox of date */
  742. X  double alpha2000, delta2000;    /* position in equinox 2000.0 */
  743. X  double beta;            /* Phase angle */
  744. X  double psi;            /* Elongation */
  745. X  double r, Delta;        /* Distance to sun, and earth */
  746. X  double mag;            /* magnitude */
  747. X  orbtype_t orbit_type;        /* Orbit type */
  748. X  elliptical_elements_t elliptical_elements;
  749. X  parabolic_elements_t parabolic_elements;
  750. X  bodytype_t body_type;        /* Body type: asteroid or comet */
  751. X  double H, G;            /* Magnitude of asteroid */
  752. X  double g, kappa;        /* Magnitude of a comet */
  753. X  observe_t eventlist[MAXEVENTS]; /* events: rise, set, etc. */
  754. X  double rise_hour, set_hour, transit_hour;
  755. X                /* times of these events */
  756. X} wanderer_data_t;
  757. X
  758. Xtypedef struct {
  759. X  char *name;
  760. X  double alpha, delta;        /* position in equinox of date */
  761. X  double alpha2000, delta2000;    /* position in equinox 2000.0 */
  762. X  double R, Theta;        /* Distance to earth, Theta equinox of date */
  763. X  double size;            /* size (arcsec) */
  764. X  double rise_hour, set_hour, transit_hour;
  765. X                /* times of these events */
  766. X} sun_data_t;
  767. X
  768. Xtypedef struct {
  769. X  char *name;
  770. X  double alpha, delta;        /* position in equinox of date */
  771. X  double alpha2000, delta2000;    /* position in equinox 2000.0 */
  772. X  double lambda, beta, moon_pi;    /* geocentric longitude and latitude
  773. X                   and horizontal parallax */
  774. X  double Delta;            /* Distance to earth (km) */
  775. X  double mag, phase, size;    /* magnitude, phase (degrees) size (arcsec) */
  776. X  double illum_frac;        /* illuminated fraction */
  777. X  double chi;            /* position angle of bright limb */
  778. X  double rise_hour, set_hour, transit_hour;
  779. X                /* times of these events */
  780. X} moon_data_t;
  781. X
  782. X
  783. Xtypedef struct {
  784. X  char *name;
  785. X  char type[3];
  786. X  double alpha, delta;        /* position in original equinox */
  787. X  double equinox;
  788. X  double alpha2000, delta2000;    /* position in equinox 2000.0 */
  789. X  double mag;
  790. X  double size;
  791. X  observe_t eventlist[MAXEVENTS]; /* events: rise, set, etc. */
  792. X  double rise_hour, set_hour, transit_hour;
  793. X                /* times of these events */
  794. X} obj_data_t;
  795. X
  796. X
  797. Xtypedef enum {
  798. X  emp,                /* Eph. Minor Planet */
  799. X  empb,                /* Eph. Minor Planet, bright */
  800. X  aa,                /* Astro. Alman */
  801. X  st,                /* Sky and Telescope */
  802. X  iau,                /* IAU circular */
  803. X  ell_e,            /* Elliptical Orbital elements:
  804. X                   Calculate ephemeris */
  805. X  par_e,            /* Parabolic Orbital elements:
  806. X                   Calculate ephemeris */
  807. X  obj,                /* Fixed object */
  808. X  no_format
  809. X} fformat_t;
  810. X
  811. X
  812. Xtypedef struct {
  813. X  double dx, dy, dz;        /* relative to planet,
  814. X                   units of equatorial radius */
  815. X  double dalpha, ddelta;    /* displacements in RA and dec. */
  816. X  double mag;
  817. X  char *name;
  818. X} sat_t;
  819. X
  820. X
  821. X/* functions */
  822. Xvoid precess();
  823. Xvoid anom_calc();
  824. Xdouble gmst0_degrees();
  825. Xvoid read_elliptical(), elliptical_pos();
  826. Xvoid read_parabolic(), parabolic_pos();
  827. Xvoid read_table(), tabulated_pos();
  828. Xvoid read_objects(), obj_pos();
  829. Xvoid calc_events(), add_events();
  830. Xvoid get_time();
  831. Xdouble now_zone();
  832. Xint now_year();
  833. Xvoid planet_pos(), moon_pos(), sun_pos();
  834. Xvoid out_obs(), out_eph(), out_sat(), out_sat_end();
  835. Xvoid out_sif(), out_sif_planet(), out_sif_body(),
  836. X  out_sif_sun(), out_sif_moon();
  837. Xvoid HeapSort(), HeapSort0();
  838. Xdouble obl_jd(), obl_year();
  839. Xvoid sun_rect();
  840. Xdouble into_range();
  841. X
  842. Xdouble sunrise(), suntransit(), sunset(), moonrise(), moontransit(), moonset(),
  843. X  morntwil(), evetwil(),
  844. X  objrise(), objrise20(), objrise30(), objtransit(),
  845. X  objset30(), objset20(), objset();
  846. X  
  847. X
  848. X/* put here for VMS and pure-ANSI systems */
  849. Xdouble atof();
  850. END_OF_FILE
  851. if test 6607 -ne `wc -c <'observe/observe.h'`; then
  852.     echo shar: \"'observe/observe.h'\" unpacked with wrong size!
  853. fi
  854. # end of 'observe/observe.h'
  855. fi
  856. if test -f 'observe/satcalc.c' -a "${1}" != "-c" ; then 
  857.   echo shar: Will not clobber existing file \"'observe/satcalc.c'\"
  858. else
  859. echo shar: Extracting \"'observe/satcalc.c'\" \(8494 characters\)
  860. sed "s/^X//" >'observe/satcalc.c' <<'END_OF_FILE'
  861. X/*
  862. X * satcalc.c
  863. X * jupiter and saturn satellites positions
  864. X *
  865. X * Copyright (c) 1990 by Craig Counterman. All rights reserved.
  866. X *
  867. X * This software may be redistributed freely, not sold.
  868. X * This copyright notice and disclaimer of warranty must remain
  869. X *    unchanged. 
  870. X *
  871. X * No representation is made about the suitability of this
  872. X * software for any purpose.  It is provided "as is" without express or
  873. X * implied warranty, to the extent permitted by applicable law.
  874. X *
  875. X */
  876. X
  877. X#ifndef  lint
  878. Xstatic char rcsid[] =
  879. X  "$Header: satcalc.c,v 1.6 90/02/19 17:21:38 ccount Exp $";
  880. X#endif
  881. X
  882. X#include <math.h>
  883. X
  884. X#include "observe.h"
  885. X#include "degree.h"
  886. X
  887. X/* given jd, return sat_t list of gallilean satellites */
  888. Xvoid jupsat(jd, jupiter, sats)
  889. X     double jd;
  890. X     planet_data_t jupiter;
  891. X     sat_t sats[4];
  892. X{
  893. X  double d;            /* modified julian date */
  894. X  double V;            /* long period term of Jupiter */
  895. X  double M;            /* mean anomaly of earth */
  896. X  double N;            /* mean anomaly of Jupiter */
  897. X  double J;            /* differance in heliocentric longitude */
  898. X  double A;            /* Center of earth */
  899. X  double B;            /* Center of jupiter */
  900. X  double K;
  901. X  double R;            /* Radius vector of earth */
  902. X  double r;            /* Radius vector of jupiter */
  903. X  double Delta;            /* Distance from earth to jupiter */
  904. X  double psi;            /* Phase angle */
  905. X  double alpha, delta;        /* Position of jupiter at equinox of date */
  906. X  double D_e;            /* == beta_e, planetocentric declination of earth */
  907. X  double u_1, u_2, u_3, u_4;    /* angle */
  908. X  double G, H;            /* correction terms */
  909. X  double cor_u_1, cor_u_2, cor_u_3, cor_u_4; /* Corrections to u_ */
  910. X  double r_1, r_2, r_3, r_4;    /* distance to center of Jupiter (radii) */
  911. X  double X_1, X_2, X_3, X_4;    /* relative Positions (radii) */
  912. X  double Y_1, Y_2, Y_3, Y_4;    /* relative Positions (radii) */
  913. X  double Z_1, Z_2, Z_3, Z_4;    /* relative Positions (radii) */
  914. X  double X, Y;
  915. X  double dmag;
  916. X
  917. X  d = jd - 2415020.0;
  918. X
  919. X  alpha = jupiter.alpha;
  920. X  delta = jupiter.delta;
  921. X
  922. X  Delta = jupiter.Delta;
  923. X  psi = jupiter.phase;
  924. X  B = jupiter.Cen;
  925. X
  926. X  D_e = jupiter.rotation_elements.beta_e;
  927. X
  928. X  u_1 = 84.5506 + 203.4058630 * (d - Delta * 0.00577167643528) + psi - B;
  929. X  u_2 = 41.5015 + 101.2916323 * (d - Delta * 0.00577167643528) + psi - B;
  930. X  u_3 = 109.9770 + 50.2345169 * (d - Delta * 0.00577167643528) + psi - B;
  931. X  u_4 = 176.3586 + 21.4879802 * (d - Delta * 0.00577167643528) + psi - B;
  932. X
  933. X  u_1 = into_range(u_1);
  934. X  u_2 = into_range(u_2);
  935. X  u_3 = into_range(u_3);
  936. X  u_4 = into_range(u_4);
  937. X
  938. X
  939. X  G = 187.3 + 50.310674 * (d - Delta * 0.00577167643528);
  940. X  H = 311.1 + 21.569229 * (d - Delta * 0.00577167643528);
  941. X  
  942. X  cor_u_1 =  0.472 * DSIN(2*(u_1 - u_2));
  943. X  cor_u_2 =  1.073 * DSIN(2*(u_2 - u_3));
  944. X  cor_u_3 =  0.174 * DSIN(G);
  945. X  cor_u_4 =  0.845 * DSIN(H);
  946. X  
  947. X  r_1 = 5.9061 - 0.0244 * DCOS(2*(u_1 - u_2));
  948. X  r_2 = 9.3972 - 0.0889 * DCOS(2*(u_2 - u_3));
  949. X  r_3 = 14.9894 - 0.0227 * DCOS(G);
  950. X  r_4 = 26.3649 - 0.1944 * DCOS(H);
  951. X  
  952. X  X_1 = r_1 * DSIN(u_1 + cor_u_1);
  953. X  X_2 = r_2 * DSIN(u_2 + cor_u_2);
  954. X  X_3 = r_3 * DSIN(u_3 + cor_u_3);
  955. X  X_4 = r_4 * DSIN(u_4 + cor_u_4);
  956. X
  957. X  Z_1 = r_1 * DCOS(u_1 + cor_u_1);
  958. X  Z_2 = r_2 * DCOS(u_2 + cor_u_2);
  959. X  Z_3 = r_3 * DCOS(u_3 + cor_u_3);
  960. X  Z_4 = r_4 * DCOS(u_4 + cor_u_4);
  961. X  
  962. X  Y_1 = - r_1 * DCOS(u_1 + cor_u_1) * DSIN(D_e);
  963. X  Y_2 = - r_2 * DCOS(u_2 + cor_u_2) * DSIN(D_e);
  964. X  Y_3 = - r_3 * DCOS(u_3 + cor_u_3) * DSIN(D_e);
  965. X  Y_4 = - r_4 * DCOS(u_4 + cor_u_4) * DSIN(D_e);
  966. X
  967. X  dmag = 5.0 * log10(jupiter.r*jupiter.Delta)
  968. X    - 2.5 * log10(jupiter.illum_frac);
  969. X
  970. X  sats[0].dx = X_1;
  971. X  sats[0].dy = Y_1;
  972. X  sats[0].dz = Z_1;
  973. X  X = -X_1*jupiter.size/2.0;
  974. X  Y = Y_1*jupiter.size/2.0;
  975. X  sats[0].dalpha = X * DCOS(jupiter.rotation_elements.p_n)
  976. X      + Y * DSIN(jupiter.rotation_elements.p_n);
  977. X  sats[0].dalpha /= DCOS(jupiter.delta);
  978. X  sats[0].ddelta = -X * DSIN(jupiter.rotation_elements.p_n)
  979. X    + Y * DCOS(jupiter.rotation_elements.p_n);
  980. X  sats[0].name = "Io";
  981. X  sats[0].mag = -1.68 + dmag;
  982. X  
  983. X  sats[1].dx = X_2;
  984. X  sats[1].dy = Y_2;
  985. X  sats[1].dz = Z_2;
  986. X  X = -X_2*jupiter.size/2.0;
  987. X  Y = Y_2*jupiter.size/2.0;
  988. X  sats[1].dalpha = X * DCOS(jupiter.rotation_elements.p_n)
  989. X      + Y * DSIN(jupiter.rotation_elements.p_n);
  990. X  sats[1].dalpha /= DCOS(jupiter.delta);
  991. X  sats[1].ddelta = -X * DSIN(jupiter.rotation_elements.p_n)
  992. X    + Y * DCOS(jupiter.rotation_elements.p_n);
  993. X  sats[1].name = "Europa";
  994. X  sats[1].mag = -1.41 + dmag;
  995. X  
  996. X  sats[2].dx = X_3;
  997. X  sats[2].dy = Y_3;
  998. X  sats[2].dz = Z_3;
  999. X  X = -X_3*jupiter.size/2.0;
  1000. X  Y = Y_3*jupiter.size/2.0;
  1001. X  sats[2].dalpha = X * DCOS(jupiter.rotation_elements.p_n)
  1002. X      + Y * DSIN(jupiter.rotation_elements.p_n);
  1003. X  sats[2].dalpha /= DCOS(jupiter.delta);
  1004. X  sats[2].ddelta = -X * DSIN(jupiter.rotation_elements.p_n)
  1005. X    + Y * DCOS(jupiter.rotation_elements.p_n);
  1006. X  sats[2].name = "Ganymede";
  1007. X  sats[2].mag = -2.09 + dmag;
  1008. X  
  1009. X  sats[3].dx = X_4;
  1010. X  sats[3].dy = Y_4;
  1011. X  sats[3].dz = Z_4;
  1012. X  X = -X_4*jupiter.size/2.0;
  1013. X  Y = Y_4*jupiter.size/2.0;
  1014. X  sats[3].dalpha = X * DCOS(jupiter.rotation_elements.p_n)
  1015. X      + Y * DSIN(jupiter.rotation_elements.p_n);
  1016. X  sats[3].dalpha /= DCOS(jupiter.delta);
  1017. X  sats[3].ddelta = -X * DSIN(jupiter.rotation_elements.p_n)
  1018. X    + Y * DCOS(jupiter.rotation_elements.p_n);
  1019. X  sats[3].name = "Callisto";
  1020. X  sats[3].mag = -1.05 + dmag;
  1021. X}
  1022. X/* siderial Periods of satellites:
  1023. X 0.942421813
  1024. X 1.370217855
  1025. X 1.887802160
  1026. X 2.736914742
  1027. X 4.517500436
  1028. X15.94542068
  1029. X21.2766088
  1030. X79.3301825
  1031. X
  1032. Xsynodic (approx)
  1033. X 0.94250436287643326
  1034. X 1.3703923657888438
  1035. X 1.8881334260185879
  1036. X 2.7376110810451278
  1037. X 4.519397869256954
  1038. X 15.969085530060568
  1039. X 21.318764097751611
  1040. X 79.919403771981642
  1041. X
  1042. Xsemimajor axes
  1043. X185.52
  1044. X238.02
  1045. X294.66
  1046. X377.40
  1047. X527.04
  1048. X1221.83
  1049. X1481.1
  1050. X3561.3
  1051. X*/
  1052. X
  1053. Xstatic struct {
  1054. X  double off; /* angle of satellite at jd 2415020.0 */
  1055. X  double angvel; /* anbular velocity, degrees per day */
  1056. X  double r; /* Distance to saturn in saturn radii */
  1057. X  double mag; /* V(1,0) */
  1058. X  char *name; /* Name */
  1059. X} satsat_data[] = {
  1060. X  {49.0, 381.96109660576467, 3.092, 3.3, "Mimas"},
  1061. X  {98.7, 262.69848620527883, 3.967, 2.1, "Enceladus"},
  1062. X  {263.0, 190.66449173515979, 4.911, 0.6, "Tethys"},
  1063. X  {101.3, 131.50151330574105, 6.290, 0.8, "Dione"},
  1064. X  {11.2, 79.656629138338852, 8.784, 0.1, "Rhea"},
  1065. X  {183.7, 22.543557633424146, 20.364, -1.28, "Titan"},
  1066. X  {95.0, 16.886532368823739, 24.685, 4.63, "Hyperion"},
  1067. X  {338.4, 4.5045381097576426, 59.355, 1.5, "Iapetus"}
  1068. X};
  1069. X
  1070. X
  1071. X/* given jd, return sat_t list of major satellites of Saturn */
  1072. X/* Ignore many corrections to Saturn's orbit,
  1073. X   assume moons in circular orbits in Saturn's equatorial plane */
  1074. Xvoid satsat(jd, saturn, sats)
  1075. X     double jd;
  1076. X     planet_data_t saturn;
  1077. X     sat_t sats[8];
  1078. X{
  1079. X  double d;            /* modified julian date */
  1080. X  double M;            /* mean anomaly of earth */
  1081. X  double N;            /* mean anomaly of Saturn */
  1082. X  double J;            /* differance in heliocentric longitude */
  1083. X  double A;            /* Center of earth */
  1084. X  double B;            /* Center of saturn */
  1085. X  double K;
  1086. X  double R;            /* Radius vector of earth */
  1087. X  double r;            /* Radius vector of Saturn */
  1088. X  double Delta;            /* Distance from earth to Saturn */
  1089. X  double psi;            /* Phase angle */
  1090. X  double alpha, delta;        /* Position of Saturn at equinox of date */
  1091. X  double D_e;            /* == beta_e, planetocentric declination of earth */
  1092. X  double u[8];            /* angle */
  1093. X  double X[8];            /* relative Positions (radii) */
  1094. X  double Y[8];            /* relative Positions (radii) */
  1095. X  double Z[8];            /* relative Positions (radii) */
  1096. X  double dmag;
  1097. X  int i;
  1098. X  double x, y;
  1099. X
  1100. X  d = jd - 2415020.0;
  1101. X
  1102. X  alpha = saturn.alpha;
  1103. X  delta = saturn.delta;
  1104. X
  1105. X  Delta = saturn.Delta;
  1106. X  psi = saturn.phase;
  1107. X  B = saturn.Cen;
  1108. X
  1109. X  /* Position of Saturn at equinox of date */
  1110. X  D_e = saturn.rotation_elements.beta_e;
  1111. X
  1112. X  dmag = 5.0 * log10(saturn.r*saturn.Delta)
  1113. X    - 2.5 * log10(saturn.illum_frac);
  1114. X
  1115. X  for (i = 0; i < 8; i++) {
  1116. X    u[i] = satsat_data[i].off
  1117. X      + satsat_data[i].angvel * (d - Delta * 0.00577167643528) + psi - B;
  1118. X
  1119. X    u[i] = into_range(u[i]);
  1120. X
  1121. X    X[i] = satsat_data[i].r * DSIN(u[i]);
  1122. X    Z[i] = satsat_data[i].r * DCOS(u[i]);
  1123. X    Y[i] = - satsat_data[i].r * DCOS(u[i]) * DSIN(D_e);
  1124. X
  1125. X    sats[i].dx = X[i];
  1126. X    sats[i].dy = Y[i];
  1127. X    sats[i].dz = Z[i];
  1128. X    x = -X[i]*saturn.size/2.0;
  1129. X    y = Y[i]*saturn.size/2.0;
  1130. X
  1131. X    sats[i].dalpha = x * DCOS(saturn.rotation_elements.p_n)
  1132. X      + y * DSIN(saturn.rotation_elements.p_n);
  1133. X    sats[i].dalpha /= DCOS(saturn.delta);
  1134. X    sats[i].ddelta = -x * DSIN(saturn.rotation_elements.p_n)
  1135. X      + y * DCOS(saturn.rotation_elements.p_n);
  1136. X    sats[i].name = satsat_data[i].name;
  1137. X    sats[i].mag = satsat_data[i].mag + dmag;
  1138. X/*printf("%d: %f %f\n", i, u[i], into_range(270 - u[i]));*/
  1139. X  };
  1140. X}
  1141. X  
  1142. X  
  1143. X  
  1144. X  
  1145. END_OF_FILE
  1146. if test 8494 -ne `wc -c <'observe/satcalc.c'`; then
  1147.     echo shar: \"'observe/satcalc.c'\" unpacked with wrong size!
  1148. fi
  1149. # end of 'observe/satcalc.c'
  1150. fi
  1151. if test -f 'starchart/interact.c' -a "${1}" != "-c" ; then 
  1152.   echo shar: Will not clobber existing file \"'starchart/interact.c'\"
  1153. else
  1154. echo shar: Extracting \"'starchart/interact.c'\" \(6247 characters\)
  1155. sed "s/^X//" >'starchart/interact.c' <<'END_OF_FILE'
  1156. X/*
  1157. X * User Interaction subroutines
  1158. X * 
  1159. X * 
  1160. X *
  1161. X * Copyright (c) 1990 by Craig Counterman. All rights reserved.
  1162. X *
  1163. X * This software may be redistributed freely, not sold.
  1164. X * This copyright notice and disclaimer of warranty must remain
  1165. X *    unchanged. 
  1166. X *
  1167. X * No representation is made about the suitability of this
  1168. X * software for any purpose.  It is provided "as is" without express or
  1169. X * implied warranty, to the extent permitted by applicable law.
  1170. X *
  1171. X */
  1172. X
  1173. Xstatic char rcsid[]="$Header: interact.c,v 1.7 90/03/10 15:33:02 ccount Exp $";
  1174. X
  1175. X#include <stdio.h>
  1176. X#include <math.h>
  1177. X
  1178. X#include "star3.h"
  1179. X#include "parse_input.h"
  1180. X#include "patchlevel.h"
  1181. X
  1182. X#define OPENFAIL 0
  1183. X#define LINELEN 82
  1184. X
  1185. X
  1186. X/* Externs */
  1187. Xextern int g_argc;
  1188. Xextern char **g_argv;
  1189. X
  1190. Xextern char *title;
  1191. X
  1192. X/* From starchart.c */
  1193. Xextern int user_interact;
  1194. X
  1195. Xextern double ra, de, sc;
  1196. Xextern double all_lbllim, all_maglim, all_gklim;
  1197. Xextern int use_lbllim, use_maglim, use_gklim;
  1198. X
  1199. Xextern double all_vmin, all_vmax;
  1200. Xextern int use_vmin;
  1201. Xextern int nomaglbls;
  1202. X
  1203. Xextern double all_rstep, all_dstep;
  1204. Xextern int use_rstep;
  1205. Xextern double all_rstrt, all_dstrt;
  1206. Xextern int no_ra_grid;
  1207. Xextern int no_dec_grid;
  1208. X
  1209. Xextern int all_invert;
  1210. X
  1211. Xextern int chart_type;
  1212. X
  1213. Xextern int all_proj_mode;
  1214. X
  1215. Xextern char *rcfile;
  1216. X
  1217. Xextern char *constfile;
  1218. Xextern char *boundfile;
  1219. Xextern char boundftype;
  1220. Xextern char *patternfile;
  1221. Xextern char pattftype;
  1222. Xextern char *cnamefile;
  1223. Xextern char cnameftype;
  1224. Xextern char *mapfiles[];
  1225. Xextern int mapftypes[];
  1226. Xextern int nummapfiles;
  1227. X
  1228. Xextern mapwindow *mapwin[];
  1229. Xextern int numwins;
  1230. X
  1231. Xextern int cur_function;
  1232. Xextern int cur_map_type;
  1233. Xextern int cur_map_tag;
  1234. Xextern char *cur_tag_field;
  1235. Xextern char *cur_file_name;
  1236. X
  1237. Xextern int read_mapwin_file;
  1238. Xextern int write_mapwin_file;
  1239. Xextern char mapwin_file[];
  1240. X
  1241. X
  1242. Xextern int all_layer[MAXLAYRS];
  1243. Xextern int numlayers;
  1244. X
  1245. X/* storage area big enough for inputs */
  1246. X#ifndef MAXPATHLEN
  1247. X#define MAXPATHLEN 1025
  1248. X#endif
  1249. Xextern char a_title[];
  1250. Xextern char a_starfile[];
  1251. Xextern char a_indexfile[];
  1252. Xextern char a_planetfile[];
  1253. Xextern char a_nebfile[];
  1254. Xextern char a_constfile[];
  1255. Xextern char a_boundfile[];
  1256. Xextern char a_patternfile[];
  1257. Xextern char a_cnamefile[];
  1258. Xextern char a_userfile[][MAXPATHLEN];
  1259. X
  1260. X/* local similar buffers */
  1261. Xchar a_constname[MAXPATHLEN];
  1262. Xchar a_rcfile[MAXPATHLEN];
  1263. Xchar *a_mapfile[MAXMAPFILES];
  1264. Xchar a_mapftypes[MAXMAPFILES][MAXPATHLEN];
  1265. X
  1266. X
  1267. X
  1268. X/* Scale multiplier, minimum,
  1269. X   mangitude change, maximum, for thumbnail */
  1270. X#define THSMUL 1.2
  1271. X#define THSMIN 12.0
  1272. X#define THMADJ 2.5
  1273. X#define THMMAX 8.0
  1274. X
  1275. Xextern mapwindow fullpage, mainmap, thumbmap;
  1276. X
  1277. X
  1278. X/* Adapted from code from Dean Payne deanp@hplsla.hp.com */
  1279. X/* Format of each line is
  1280. X    variable_name variable_value
  1281. Xor    variable_name=variable_value
  1282. X
  1283. Xvariable_value may be a string which extends to the end of line.
  1284. XLines must be 80 chars max.
  1285. XComments are anything after a #
  1286. XBlank lines are allowed.
  1287. X*/
  1288. XD_userinput()
  1289. X{
  1290. X  char sbuf[LINELEN], *var_name, *c_buf;
  1291. X  double f_buf;    /* value parsed as double */
  1292. X  int i_buf;    /* value parsed as integer */
  1293. X  int l_buf;    /* value parsed as TRUE or FALSE */
  1294. X  int ret_code, var_type;
  1295. X  static int first_time = TRUE; 
  1296. X  static int printed_notice = FALSE;
  1297. X
  1298. X    if (!user_interact)
  1299. X      if (first_time) {
  1300. X    first_time = FALSE;
  1301. X    return TRUE;
  1302. X      } else return FALSE;    /* If we don't really want user interaction,
  1303. X                   i.e. -u wasn't used,
  1304. X                   only do the main loop once */
  1305. X
  1306. X  if (!printed_notice) {
  1307. X    printf("Starchart Version %s, patchlevel %s\n", VERSION_STRING,
  1308. X       PATCHLEVEL_STRING);
  1309. X    printf(
  1310. X    "This is a copyrighted program, however the source is freely available\n");
  1311. X    printf("and freely redistributable for noncommercial use.\n");
  1312. X    printf("Distributed 'as is', with no warranty.\n\n\n");
  1313. X    printed_notice = TRUE;
  1314. X  };
  1315. X
  1316. X
  1317. X  printf("Please type your commands:\n");
  1318. X  for (;;) {
  1319. X    fgets(sbuf, LINELEN, stdin);
  1320. X    if (ferror(stdin)) { fprintf(stderr, "file read error \n"); break; }
  1321. X    if (feof(stdin)) return TRUE;
  1322. X
  1323. X
  1324. X    if (!parse_line(sbuf, &var_name, &ret_code, &var_type,
  1325. X            &c_buf, &f_buf, &i_buf, &l_buf)) {
  1326. X      /* Not recognized by parse routine,
  1327. X     see if ident_rc can recognize it */
  1328. X      if (!(ident_rc(var_name, c_buf))) {
  1329. X    fprintf(stderr, "cannot interpret '%s = %s'\n", var_name, c_buf);
  1330. X    help_vars(var_name);
  1331. X      }
  1332. X    } else
  1333. X      switch (ret_code) {
  1334. X      case TINT:
  1335. X    fprintf(stderr, "int = %d\n", i_buf);
  1336. X    fprintf(stderr, "i_buf = %d\n", i_buf);
  1337. X    fprintf(stderr, "f_buf = %f\n", f_buf);
  1338. X    fprintf(stderr, "l_buf = %d\n", l_buf);
  1339. X    fprintf(stderr, "c_buf = %s\n", c_buf);
  1340. X    break;
  1341. X      case TFLO:
  1342. X    fprintf(stderr, "flo = %f\n", f_buf);
  1343. X    fprintf(stderr, "i_buf = %d\n", i_buf);
  1344. X    fprintf(stderr, "f_buf = %f\n", f_buf);
  1345. X    fprintf(stderr, "l_buf = %d\n", l_buf);
  1346. X    fprintf(stderr, "c_buf = %s\n", c_buf);
  1347. X    break;
  1348. X      case TBOOL:
  1349. X    fprintf(stderr, "bool = %d\n", l_buf);
  1350. X    fprintf(stderr, "i_buf = %d\n", i_buf);
  1351. X    fprintf(stderr, "f_buf = %f\n", f_buf);
  1352. X    fprintf(stderr, "l_buf = %d\n", l_buf);
  1353. X    fprintf(stderr, "c_buf = %s\n", c_buf);
  1354. X    break;
  1355. X      case TNONE:
  1356. X    fprintf(stderr, "none = %s\n", c_buf);
  1357. X    fprintf(stderr, "i_buf = %d\n", i_buf);
  1358. X    fprintf(stderr, "f_buf = %f\n", f_buf);
  1359. X    fprintf(stderr, "l_buf = %d\n", l_buf);
  1360. X    fprintf(stderr, "c_buf = %s\n", c_buf);
  1361. X    break;
  1362. X      case TCHAR:
  1363. X    fprintf(stderr, "char = %s\n", c_buf);
  1364. X    fprintf(stderr, "i_buf = %d\n", i_buf);
  1365. X    fprintf(stderr, "f_buf = %f\n", f_buf);
  1366. X    fprintf(stderr, "l_buf = %d\n", l_buf);
  1367. X    fprintf(stderr, "c_buf = %s\n", c_buf);
  1368. X    break;
  1369. X      case END_INPUT:
  1370. X    return TRUE;
  1371. X    break;
  1372. X      case EXIT:
  1373. X    exit(0);
  1374. X    break;
  1375. X      case HELP_ME:
  1376. X    help_vars("");
  1377. X    break;
  1378. X      case SHOW_ME:
  1379. X    rc_write(stderr);
  1380. X    break;
  1381. X      case WRITE_RC_FILE:
  1382. X    {
  1383. X      FILE *tfile;
  1384. X
  1385. X      if ((tfile = fopen(c_buf, "w")) != NULL)
  1386. X        if (rc_write(tfile)) {
  1387. X          fclose(tfile);
  1388. X          printf("wrote %s\n", c_buf);
  1389. X        };
  1390. X    };
  1391. X    break;
  1392. X      default:
  1393. X    /* Identified but not special to this routine,
  1394. X       try to set variables */
  1395. X    if (!set_varvals(var_name, ret_code, var_type,
  1396. X            c_buf, f_buf, i_buf, l_buf)) {
  1397. X      fprintf(stderr, "cannot interpret '%s = %s'\n", var_name, c_buf);
  1398. X      help_vars(var_name);
  1399. X    };
  1400. X    break;
  1401. X      };
  1402. X
  1403. X    /* Always call ident_rc */
  1404. X    ident_rc(var_name, c_buf);
  1405. X  }
  1406. X  
  1407. X  
  1408. X  return TRUE;
  1409. X}
  1410. X
  1411. XD_mapwininput()
  1412. X{
  1413. X  return TRUE;
  1414. X}
  1415. X
  1416. XD_break()
  1417. X{
  1418. X  return FALSE;
  1419. X}
  1420. X
  1421. END_OF_FILE
  1422. if test 6247 -ne `wc -c <'starchart/interact.c'`; then
  1423.     echo shar: \"'starchart/interact.c'\" unpacked with wrong size!
  1424. fi
  1425. # end of 'starchart/interact.c'
  1426. fi
  1427. if test -f 'starchart/starcust.c' -a "${1}" != "-c" ; then 
  1428.   echo shar: Will not clobber existing file \"'starchart/starcust.c'\"
  1429. else
  1430. echo shar: Extracting \"'starchart/starcust.c'\" \(8320 characters\)
  1431. sed "s/^X//" >'starchart/starcust.c' <<'END_OF_FILE'
  1432. X/*
  1433. X * Customizing functions
  1434. X */
  1435. X
  1436. X/*
  1437. X * Produced for starchart 3.0 by Craig Counterman Jan, 1989
  1438. X *
  1439. X * Copyright (c) 1989 by Craig Counterman
  1440. X * Portions Copyright (c) 1987 by Alan Paeth (awpaeth@watcgl)
  1441. X *
  1442. X * Copyright (c) 1990 by Craig Counterman. All rights reserved.
  1443. X *
  1444. X * This software may be redistributed freely, not sold.
  1445. X * This copyright notice and disclaimer of warranty must remain
  1446. X *    unchanged. 
  1447. X *
  1448. X * No representation is made about the suitability of this
  1449. X * software for any purpose.  It is provided "as is" without express or
  1450. X * implied warranty, to the extent permitted by applicable law.
  1451. X *
  1452. X */
  1453. X
  1454. X
  1455. Xstatic char rcsid[]="$Header: starcust.c,v 2.4 90/03/10 15:34:28 ccount Exp $";
  1456. X
  1457. X#include <stdio.h>
  1458. X#include <math.h>
  1459. X#ifndef SYSV
  1460. X#include <strings.h>
  1461. X#else
  1462. X#include <string.h>
  1463. X#endif
  1464. X
  1465. X#include "star3.h"
  1466. X
  1467. X#ifndef MAXPATHLEN
  1468. X#define MAXPATHLEN 1025
  1469. X#endif
  1470. X
  1471. X/* Externs */
  1472. Xextern int g_argc;
  1473. Xextern char **g_argv;
  1474. X
  1475. X
  1476. X/* title, mapwin, and numwins are the
  1477. X   mostly device independent specifications for the plot */
  1478. Xextern char *title;    /* Title of page */
  1479. X
  1480. Xextern mapwindow *mapwin[MAXWINDOWS];
  1481. Xextern int numwins;
  1482. X
  1483. X/*
  1484. Xmapwindow s_mapwin[MAXWINDOWS];
  1485. Xchar s_filenames[MAXWINDOWS][MAXMAPFILES][MAXPATHLEN];
  1486. Xchar s_tag_fields[MAXWINDOWS][81];
  1487. X*/
  1488. X
  1489. Xextern int cur_function;
  1490. Xextern int cur_map_type;
  1491. Xextern int cur_map_tag;
  1492. Xextern char *cur_tag_field;
  1493. X
  1494. Xextern int read_mapwin_file;
  1495. Xextern int write_mapwin_file;
  1496. Xextern char mapwin_file[];
  1497. X
  1498. X/* Set by initxform
  1499. X   One could use elements of the mapwindow structure,
  1500. X   but these should be faster for the current window */
  1501. Xextern int xproj_mode;
  1502. Xextern double xwest, xeast, xnorth, xsouth, xbot;
  1503. Xextern int cenx, ceny, strty;
  1504. Xextern double xracen, sindlcen, cosdlcen, chart_scale;
  1505. Xextern double yscale;
  1506. Xextern double xc_scale;
  1507. Xextern double inv_;
  1508. X
  1509. X/* Scale multiplier, minimum,
  1510. X   mangitude change, maximum, for thumbnail,*/
  1511. Xextern double th_smul;
  1512. Xextern double th_smin;
  1513. Xextern double th_madj;
  1514. Xextern double th_mmax;
  1515. X
  1516. X
  1517. X#define MAX(a,b) ((a)>(b)?(a):(b))
  1518. X#define MIN(a,b) ((a)<(b)?(a):(b))
  1519. X
  1520. Xchar *malloc();
  1521. X
  1522. X/* Other functions */
  1523. Xident_arg(argi)        /* argc and argv are already available as externs */ 
  1524. X     int *argi;        /* The argument which can't be understood */
  1525. X{
  1526. X  /*printf("Identify '%s' '%s'\n", g_argv[*argi], g_argv[*argi+1]);*/
  1527. X
  1528. X  return FALSE;
  1529. X}
  1530. X/* Return TRUE and increment argi if the argument has been interpreted.
  1531. X   Return FALSE if the argument is an error */
  1532. X
  1533. X
  1534. Xident_rc(var_name, var_val)
  1535. X     char *var_name, *var_val;
  1536. X{
  1537. X  /*printf("Identify '%s' '%s'\n", var_name, var_val);*/
  1538. X
  1539. X  return FALSE;
  1540. X}
  1541. X/* Return TRUE if the variable has been interpreted.
  1542. X   Return FALSE if the variable is an error */
  1543. X
  1544. X
  1545. X/* Do final adjustments before drawing begins */
  1546. Xfix_mapwin()
  1547. X{
  1548. X  int i, j;
  1549. X  FILE *mfile;
  1550. X
  1551. X  for (i = 0; i < numwins; i++) {
  1552. X    if (mapwin[i]->map_type == THUMBNAIL) {
  1553. X      /* No constellation names in thumbnail */
  1554. X      for (j =0; j < mapwin[i]->nlayers; j++) {
  1555. X    if (mapwin[i]->layer[j] == CONSTLNAMES)
  1556. X      mapwin[i]->layer[j] = SKIP;
  1557. X    if (mapwin[i]->layer[j] == LEGENDS)
  1558. X      mapwin[i]->layer[j] = SKIP;
  1559. X      }
  1560. X
  1561. X      /* No grids, don't invert */
  1562. X      mapwin[i]->draw_ragrid = FALSE;
  1563. X      mapwin[i]->draw_decgrid = FALSE;
  1564. X      mapwin[i]->invert = FALSE;
  1565. X
  1566. X      if ((mapwin[i]->proj_mode == STEREOGR) ||
  1567. X      (mapwin[i]->proj_mode == GNOMONIC) ||
  1568. X      (mapwin[i]->proj_mode == ORTHOGR)) {
  1569. X      /* If the parent map of this thumbnail map is stereographic,
  1570. X     gnomonic, or orthographic,
  1571. X     double the scale, for Sanson's projection */
  1572. X    mapwin[i]->scale *= 2.0;
  1573. X
  1574. X    if ((90.0 - fabs(mapwin[i]->dlcen)) < (mapwin[i]->scale/2.0)) {
  1575. X      /* pole is in map shouldn't draw this map */
  1576. X      if (i == (numwins-1)) numwins--;
  1577. X      else {
  1578. X        for (j = i; j < numwins; j++)
  1579. X          mapwin[j] = mapwin[i];
  1580. X        numwins--;
  1581. X      }
  1582. X    }
  1583. X      }
  1584. X
  1585. X
  1586. X
  1587. X      /* Thumbnail must be Sanson's */
  1588. X      mapwin[i]->proj_mode = SANSONS;
  1589. X
  1590. X
  1591. X      /* Do scale, mag adjustments for thumbnail */
  1592. X      mapwin[i]->scale = MAX(mapwin[i]->scale * th_smul, th_smin);
  1593. X
  1594. X      for (j =0; j < mapwin[i]->numfiles; j++) {
  1595. X    mapwin[i]->file[j].maglim =  MIN(th_mmax,
  1596. X                     mapwin[i]->maglim - th_madj);
  1597. X    mapwin[i]->file[j].lbllim = MIN(mapwin[i]->maglim,
  1598. X                    mapwin[i]->lbllim - th_madj);
  1599. X    mapwin[i]->file[j].gklim = MIN(mapwin[i]->maglim,
  1600. X                       mapwin[i]->gklim - th_madj);
  1601. X    mapwin[i]->file[j].draw_maglbl = FALSE;
  1602. X      }
  1603. X    }
  1604. X  }
  1605. X  
  1606. X  /* Read mapwin structures from mapwin file */
  1607. X  if ((read_mapwin_file)  && ((mfile = fopen(mapwin_file, "r")) != NULL)) {
  1608. X    read_mfile(mfile);
  1609. X    fclose(mfile);
  1610. X  }
  1611. X}
  1612. X
  1613. Xchar s_title[81];
  1614. X
  1615. Xread_mfile(mfile)
  1616. X     FILE *mfile;
  1617. X{
  1618. X  int i, j;
  1619. X  int n, o, p;
  1620. X  char line[300];
  1621. X  
  1622. X  /* Check tag on file as being mapwin format */
  1623. X  n = fscanf(mfile, "%[^\n]\n", line);
  1624. X  if (!strcmp(line,
  1625. X          "#mapwin format 1 file: don't edit this line or change order of lines in this file\n"))
  1626. X    return FALSE;
  1627. X
  1628. X  /* set mapwin pointer to real storage
  1629. X     set filename pointers and tag_field pointer to real storage */
  1630. X/*
  1631. X  for (i = 0; i < MAXWINDOWS; i++) {
  1632. X    mapwin[i] = &s_mapwin[i];
  1633. X    s_mapwin[i].tag_field = s_tag_fields[i];
  1634. X    for (j = 0; j < MAXMAPFILES; j++)
  1635. X      s_mapwin[i].file[j].name = s_filenames[i][j];
  1636. X  };
  1637. X*/
  1638. X
  1639. X  /* read the title */
  1640. X  fscanf(mfile, "title=%[^\n]\n", s_title);
  1641. X  title = s_title;
  1642. X
  1643. X  /* read number of mapwins */
  1644. X  fscanf(mfile, "numwins=%d\n", &numwins);
  1645. X  for (i = 0; i < numwins; i++) {
  1646. X    fscanf(mfile, "mapwin=%d\n",&n);
  1647. X    if (n != i) fprintf(stderr, "Error in mapwin file");
  1648. X    n = i;
  1649. X
  1650. X    /* Allocate space for this mapwin */
  1651. X    mapwin[n] = (mapwindow *) malloc(sizeof(mapwindow));
  1652. X    mapwin[n]->tag_field = (char *) malloc(MAXPATHLEN);
  1653. X    
  1654. X    fscanf(mfile, "width=%d\n", &(mapwin[n]->width));
  1655. X    fscanf(mfile, "height=%d\n", &(mapwin[n]->height));
  1656. X    fscanf(mfile, "x_offset=%d\n", &(mapwin[n]->x_offset));
  1657. X    fscanf(mfile, "y_offset=%d\n", &(mapwin[n]->y_offset));
  1658. X    
  1659. X    fscanf(mfile, "maglim=%lf\n", &(mapwin[n]->maglim));
  1660. X    fscanf(mfile, "lbllim=%lf\n", &(mapwin[n]->lbllim));
  1661. X    fscanf(mfile, "gklim=%lf\n", &(mapwin[n]->gklim));
  1662. X    
  1663. X    
  1664. X    fscanf(mfile, "map_type=%d\n", &(mapwin[n]->map_type));
  1665. X    
  1666. X    
  1667. X    fscanf(mfile, "tag=%d\n", &(mapwin[n]->tag));
  1668. X    
  1669. X    fscanf(mfile, "tag_field=%s\n", mapwin[n]->tag_field);
  1670. X    
  1671. X    
  1672. X    fscanf(mfile, "proj_mode=%d\n", &(mapwin[n]->proj_mode));
  1673. X    
  1674. X    
  1675. X    fscanf(mfile, "draw_ragrid=%d\n", &(mapwin[n]->draw_ragrid));
  1676. X    fscanf(mfile, "draw_decgrid=%d\n", &(mapwin[n]->draw_decgrid));
  1677. X    
  1678. X    fscanf(mfile, "ra_step=%lf\n", &(mapwin[n]->ra_step));
  1679. X    fscanf(mfile, "dec_step=%lf\n", &(mapwin[n]->dec_step));
  1680. X    
  1681. X    fscanf(mfile, "ra_strt=%lf\n", &(mapwin[n]->ra_strt));
  1682. X    fscanf(mfile, "dec_strt=%lf\n", &(mapwin[n]->dec_strt));
  1683. X    
  1684. X    
  1685. X    fscanf(mfile, "invert=%d\n", &(mapwin[n]->invert));
  1686. X    
  1687. X    fscanf(mfile, "racen=%lf\n", &(mapwin[n]->racen));
  1688. X    fscanf(mfile, "dlcen=%lf\n", &(mapwin[n]->dlcen));
  1689. X    fscanf(mfile, "scale=%lf\n", &(mapwin[n]->scale));
  1690. X    
  1691. X    fscanf(mfile, "c_scale=%lf\n", &(mapwin[n]->c_scale));
  1692. X    
  1693. X    fscanf(mfile, "nlayers=%d\n", &(mapwin[n]->nlayers));
  1694. X    for (j = 0; j < mapwin[n]->nlayers; j++) {
  1695. X      fscanf(mfile, "layer[%d] = %d\n", &o, &p);
  1696. X      mapwin[n]->layer[o] = p;
  1697. X    }
  1698. X    
  1699. X    fscanf(mfile, "numfiles=%d\n", &(mapwin[n]->numfiles));
  1700. X    for (j = 0; j < mapwin[n]->numfiles; j++) {
  1701. X      fscanf(mfile, "file=%d\n", &o);
  1702. X      if (o != j) fprintf(stderr, "Error in mapwin file");
  1703. X      o = j;
  1704. X
  1705. X      /* Allocate space for the file name */
  1706. X      mapwin[n]->file[o].name = (char *) malloc(MAXPATHLEN);
  1707. X
  1708. X
  1709. X      fscanf(mfile, "name=%s\n", (mapwin[n]->file[o].name));
  1710. X      fscanf(mfile, "type=%d\n", &(mapwin[n]->file[o].type));
  1711. X      fscanf(mfile, "maglim=%lf\n", &(mapwin[n]->file[o].maglim));
  1712. X      fscanf(mfile, "lbllim=%lf\n", &(mapwin[n]->file[o].lbllim));
  1713. X      fscanf(mfile, "gklim=%lf\n", &(mapwin[n]->file[o].gklim));
  1714. X      fscanf(mfile, "draw_maglbl=%d\n", &(mapwin[n]->file[o].draw_maglbl));
  1715. X      fscanf(mfile, "maglmin=%lf\n", &(mapwin[n]->file[o].maglmin));
  1716. X      fscanf(mfile, "maglmax=%lf\n", &(mapwin[n]->file[o].maglmax));
  1717. X    }
  1718. X  }
  1719. X  
  1720. X  /* Check tag on file as being mapwin format */
  1721. X  n = fscanf(mfile, "%[^\n]\n", line);
  1722. X  if (!strcmp(line,
  1723. X          "#mapwin format 1 file: don't edit this line or change order of lines in this file\n"))
  1724. X    return FALSE;
  1725. X  
  1726. X  return TRUE;
  1727. X}
  1728. X
  1729. END_OF_FILE
  1730. if test 8320 -ne `wc -c <'starchart/starcust.c'`; then
  1731.     echo shar: \"'starchart/starcust.c'\" unpacked with wrong size!
  1732. fi
  1733. # end of 'starchart/starcust.c'
  1734. fi
  1735. echo shar: End of archive 5 \(of 32\).
  1736. cp /dev/null ark5isdone
  1737. MISSING=""
  1738. for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 ; do
  1739.     if test ! -f ark${I}isdone ; then
  1740.     MISSING="${MISSING} ${I}"
  1741.     fi
  1742. done
  1743. if test "${MISSING}" = "" ; then
  1744.     echo You have unpacked all 32 archives.
  1745.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  1746. else
  1747.     echo You still need to unpack the following archives:
  1748.     echo "        " ${MISSING}
  1749. fi
  1750. ##  End of shell archive.
  1751. exit 0
  1752.  
  1753.